<?php

use Phinx\Migration\AbstractMigration;

class AnalysisStatic extends AbstractMigration
{
    public function up()
    {
        $table = $this->table("analysis_static");
        $table->addColumn('day', 'integer', ['limit'=>8, "comment"=>"年月日"])
              ->addColumn('channel', 'string', ['limit'=>100, "comment"=>"渠道"])
              ->addColumn('vcode', 'string', ['limit'=>100, "comment"=>"版本号"])
              ->addColumn('active', 'integer', ['limit'=>10, "comment"=>"新增"])
              ->addColumn('retain', 'integer', ['limit'=>10, "comment"=>"留存"])
              ->addColumn('show', 'integer', ['limit'=>10, "comment"=>"展示"])
              ->addColumn('click', 'integer', ['limit'=>10, "comment"=>"点击"])
              ->addColumn('postback', 'integer', ['limit'=>10, "comment"=>"转化"])
              ->addColumn('income', 'float', ['limit'=>10, "comment"=>"收益"])
              ->addColumn('ratio_show', 'float', ['limit'=>10, "comment"=>"百分比", "default"=>"100"])
              ->addColumn('ratio_click', 'float', ['limit'=>10, "comment"=>"百分比", "default"=>"100"])
              ->addColumn('ratio_income', 'float', ['limit'=>10, "comment"=>"百分比", "default"=>"100"])
              ->addColumn('last_modify', 'integer', ["limit"=>10, "comment"=>"更新时间"])
              ->addIndex(["day", "channel"])
              ->save();
        
        $table = $this->table("sys_channel");
        $table->addColumn('ratio_show', 'decimal', ["scale"=>2, "precision"=>10, "comment"=>"百分比", "default"=>"100"])
              ->addColumn('ratio_click', 'decimal', ["scale"=>2, "precision"=>10, "comment"=>"百分比", "default"=>"100"])
              ->save();
    }
}
